home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / metkit / k4strat.h < prev    next >
C/C++ Source or Header  |  1997-06-07  |  2KB  |  76 lines

  1. //    Copyright (C) 1996, 1997 Meta Four Software.  All rights reserved.
  2. //
  3. //    Strategy declarations
  4. //
  5. //! rev="$Id: k4strat.h,v 1.19 1997/06/05 08:31:51 jcw Rel $"
  6.  
  7. #ifndef __K4STRAT_H__
  8. #define __K4STRAT_H__
  9.  
  10. /////////////////////////////////////////////////////////////////////////////
  11. // Declarations in this file
  12.  
  13.     class c4_Strategy;                  // system and file interface
  14.  
  15.     class c4_Column;                    // not defined here
  16.     class c4_ColCache;                  // not defined here
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. //: A strategy encapsulates code dealing with file I/O and the system.
  20.  
  21. class c4_Strategy
  22. {     
  23. public:
  24.     c4_Strategy (c4_File* file_ =0);
  25.         //: Constructs a new strategy object.
  26.     virtual ~c4_Strategy ();
  27.  
  28.     virtual bool DataOpen(const char* fileName_, bool allowWriting_);
  29.         //: Opens a data file by name.
  30.  
  31.     virtual void DataSeek(t4_i32 position_);
  32.         //: Sets file position.
  33.     virtual int  DataRead(void* buffer_, int length_);
  34.         //: Reads a number of bytes.
  35.     virtual void DataLoad(void* buffer_, int length_);
  36.         //: Reads an exact number of bytes.
  37.     virtual void DataWrite(const void* buffer_, int length_);
  38.         //: Writes a number of bytes.
  39.     virtual void DataCommit(t4_i32 newSize_);
  40.         //: Flushes and truncate file.
  41.  
  42.     virtual int  StreamRead(void* auxArg_, void* buffer_, int length_);
  43.         //: Consumes some bytes sequentially.
  44.     virtual void StreamWrite(void* auxArg_, const void* buffer_, int length_);
  45.         //: Produces some bytes sequentially.
  46.  
  47.     c4_ColCache* _colCache;
  48.         //: Holds a cache manager for all columns.
  49.  
  50.     bool _keepAfterCommit;
  51.         //: Keep data in memory after each commit (default is false).
  52.     bool _bytesFlipped;
  53.         //: True if the storage format is not native (default is false).
  54.  
  55.     const t4_byte* _mapStart;
  56.         //: First byte in file mapping, zero if not active.
  57.     const t4_byte* _mapLimit;
  58.         //: Past last byte in file mapping, zero if not active.
  59.  
  60.     /* bool _copyOnDetach; */
  61.         /*: Copy to view when storage goes away (default is false). */
  62.  
  63. protected:
  64.     c4_File* _file;
  65.         //: Pointer to file object.
  66.  
  67. private:
  68.     void ResetFileMapping();
  69.  
  70.     c4_File* _cleanup;
  71. };
  72.  
  73. /////////////////////////////////////////////////////////////////////////////  
  74.  
  75. #endif
  76.